package cn.mj.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class HomeController {
	
	@RequestMapping("/index")
	public String index(HttpServletRequest request) {
		request.getSession().setAttribute("user", "masterJ");
		return "index";
	}
	
	@RequestMapping("/home")
	public String home(HttpServletRequest request) {
		HttpSession session = request.getSession();
		System.out.println(session);
		System.out.println(session.getCreationTime());
		System.out.println(session.getMaxInactiveInterval());
		System.out.println(session.getId());
		
		Object user = session.getAttribute("user");
		System.out.println(user);
		return "home";
	}
	
}
